package com.mjh.partners.controller;

import com.mjh.partners.pojo.Book;
import com.mjh.partners.pojo.Experience;
import com.mjh.partners.pojo.ShowMe;
import com.mjh.partners.pojo.User;
import com.mjh.partners.service.BookService;
import com.mjh.partners.service.ExperienceService;
import com.mjh.partners.service.ShowMeService;
import com.mjh.partners.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("/MyController")
@Controller
public class MyController {
    @Autowired
    private UserService userService;
    @Autowired
    private ExperienceService experienceService;
    @Autowired
    private BookService bookService;
    @Autowired
    private ShowMeService showMeService;
    @RequestMapping("getPartnerPage")
    public String getPartnerPage(int userid, Model model){
        User user=userService.getPartners(userid);
        List<Experience> ExList=experienceService.getExperienceByUserid(userid);
        List<Book> BList=bookService.getBookByUid(userid);
        List<ShowMe> SList=showMeService.getShowByUserid(userid);
        model.addAttribute("User",user);
        model.addAttribute("ExList",ExList);
        model.addAttribute("BList",BList);
        return "partnerPage";
    }

}
